import 'package:flutter/services.dart';

class AlivcEnvironmentManager {
  // 与原生通信的通道名称
  static const MethodChannel _channel = MethodChannel('alivc_environment');

  // 设置全局环境的异步方法
  static Future<void> setGlobalEnvironment(String environment) async {
    try {
      // 调用原生方法设置环境
      await _channel.invokeMethod('setGlobalEnvironment', {
        'environment': environment,
      });
      print('环境设置为"$environment"成功');
    } on PlatformException catch (e) {
      print('设置环境失败: ${e.message}');
      throw e;
    }
  }
}
